#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>
#include <malloc.h>

char* interpret(char* command) 
{
    int i = 0;
    int len = strlen(command);
    char* str = (char*)malloc(sizeof(char) * (len+1));

    while (*command)
    {
        if (*command == 'G')
        {
            str[i++] = *command;
        }
        if (*command == '(')
        {
            if (*(command + 1) == ')')
            {
                str[i++] = 'o';
            }
            else
            {
                str[i++] = 'a';
                str[i++] = 'l';
            }
        }
        command++;
    }
    str[i] = '\0';
    return str;
}

int main()
{
    char arr[] = "G()(al)";
    //char ret[20];
    char* ret = interpret(arr);
    printf("%s", ret);
}